
		**********************************************************
		** File: Figure_2.do									**
		** Paper: Human Trafficking Indicators: A New Dataset	**
		** Author: Richard Frank								**
		** Date: July 11, 2021									**
		** Task: Creating Figure 2								**
 		**********************************************************

 
 

	clear
	version 16.1
	set seed 1234
	set scheme lean1
	graph set window fontface "Times New Roman"

	use "HTI_v1.dta"
	
	** SUMMARY STATISTICS FOR 2001-2016

	drop if ccode==-11
	drop if ccode==-22
	drop if ccode==-33
 
	sort year
	by year: egen totalcountries=count(ccode)
	label var totalcountries "Total # countries in given year"

 
				***********************************
				** Domestic Laws and Enforcement **
				***********************************

	**DICHOTOMIZING **
		gen dsomdich=.
		replace dsomdich=1 if domesticlaws==1
		label var dsomdich "Domestic laws=some (dich)"

		gen dyesdich=.
		replace dyesdich =1 if domesticlaws==2
		label var dyesdich "Domestic laws= yes(dich)"

		gen dnodich=.
		replace dnodich =1 if domesticlaws==-1	
		label var dnodich "Domestic laws=no (dich)"


	**TOTAL IN A YEAR **
		sort year
		by year: egen dsomtot=count(dsomdich)
		label var dsomtot "Total # domesticlaws=some in a year"

		sort year
		by year: egen dyestot=count(dyesdich)
		label var dyestot "Total # domesticlaws=yes in a year"

		sort year
		by year: egen dnotot=count(dnodich)
		label var dnotot "Total # domesticlaws=no in a year"


	**PERCENTAGE **

		gen dsompct=dsomtot/totalcountries
		label var dsompct "Some"

		gen dyespct=dyestot/totalcountries
		label var dyespct "Yes"

		gen dnopct=dnotot/totalcountries
		label var dnopct "No"


	twoway (line dsompct year, sort) (line dyespct year, sort) ///
	 (line dnopct year, sort), ///
	 ytitle(% of countries in sample) title(Domestic Laws) legend(pos(6) cols(3))
	 
	graph save domesticlaws.gph, replace

						*******************
						*** ENFORCEMENT ***
						*******************

	**DICHOTOMIZING **
		gen esomdich=.
		replace esomdich=1 if enforcement==1
		label var esomdich "Enforcement=some (dich)"

		gen eyesdich=.
		replace eyesdich =1 if enforcement==2
		label var eyesdich "Enforcement= yes(dich)"

		gen enodich=.
		replace enodich =1 if enforcement==-1	
		label var enodich "Enforcement=no (dich)"


	**TOTAL IN A YEAR **
		sort year
		by year: egen esomtot=count(esomdich)
		label var esomtot "Total # Enforcement=some in a year"

		sort year
		by year: egen eyestot=count(eyesdich)
		label var eyestot "Total # Enforcement=yes in a year"

		sort year
		by year: egen enotot=count(enodich)
		label var enotot "Total # Enforcement=no in a year"


	**PERCENTAGE **

		gen esompct=esomtot/totalcountries
		label var esompct "Some"

		gen eyespct=eyestot/totalcountries
		label var eyespct "Yes"

		gen enopct=enotot/totalcountries
		label var enopct "No"


	twoway (line esompct year, sort) (line eyespct year, sort) ///
	 (line enopct year, sort), ///
	 ytitle(% of countries in sample) title(Enforcement) legend(pos(6) cols(3))
	graph save enforcement.gph, replace
	
	graph combine domesticlaws.gph enforcement.gph, ycommon  
